Crate esp_idf_part
source ·Expand description
A library for parsing and generating ESP-IDF partition tables, both in the binary and CSV formats as described in the ESP-IDF documentation.
For additional information regarding the partition table format please refer
to the ESP-IDF documentation:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html
Features
There is currently only a single feature, std
; this feature is enabled by
default.
The following functionality is unavailable if the std
feature is disabled:
- (De)serializing a PartitionTable from/to CSV or binary format
- Writing a Partition to a CSV or binary writer
Examples
ⓘ
// Read a partition table from a CSV file:
let csv = std::fs::read_to_string("partitions.csv").unwrap();
let table = PartitionTable::try_from_str(csv).unwrap();
// Read a partition table from a binary file:
let bin = std::fs::read("partitions.bin").unwrap();
let table = PartitionTable::try_from_bytes(bin).unwrap();
// Or, you can automatically determine which format is being passed:
let table = PartitionTable::try_from(csv).unwrap();
let table = PartitionTable::try_from(bin).unwrap();
// You can find a partition by name, type, or subtype:
let foo = table.find("factory").unwrap();
let bar = table.find_by_type(Type::App).unwrap();
let baz = table.find_by_type(Type::Data, DataType::Ota).unwrap();
Structs
- A single partition definition
- A partition table; a collection of partitions
Enums
- Partition sub-types which can be used with
Type::App
partitions - Partition sub-types which can be used with
Type::Data
partitions - Partition table errors
- Supported partition subtypes
- Supported partition types